#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>

//https://www.luogu.com.cn/problem/P1055

char ch;
std::string a;
char res;
std::string origin;
int main()
{
	int str;
	std::cin >> str;
	a += std::to_string(str);
	std::cin >> ch;
	origin += std::to_string(str) + ch;

	std::cin >> str;
	a += std::to_string(str);
	std::cin >> ch;
	origin += std::to_string(str) + ch;
	
	std::cin >> str;
	a += std::to_string(str);
	std::cin >> ch;
	origin += std::to_string(str) + ch;

	std::cin >> res;

	a = ' ' + a;
	int isbn=0;
	for (int i = 1; i <= 9; ++i)
	{
		isbn += (a[i] - '0') * i;
		isbn %= 11;
	}
	//std::cout << "isbn: " << isbn << std::endl;
	//std::cout << "res: " << res << std::endl;
	if (isbn == 10)
	{
		if(res == 'X')
			std::cout << "Right" << std::endl;
		else
			std::cout << origin << 'X' << std::endl;
	}
	else
	{
		if (isbn == res-'0')
			std::cout << "Right" << std::endl;
		else
			std::cout << origin << isbn << std::endl;

	}


	return 0;
}